#ifndef NAL_H
#define NAL_H
#include <stdint.h>

enum nal_unit_type_e
{
    NAL_UNKNOWN     = 0,
    NAL_SLICE       = 1,
    NAL_SLICE_DPA   = 2,
    NAL_SLICE_DPB   = 3,
    NAL_SLICE_DPC   = 4,
    NAL_SLICE_IDR   = 5,    /* ref_idc != 0 */
    NAL_SEI         = 6,    /* ref_idc == 0 */
    NAL_SPS         = 7,
    NAL_PPS         = 8,
    NAL_AUD         = 9,
    NAL_FILLER      = 12,
    /* ref_idc == 0 for 6,9,10,11,12 */
};

enum nal_priority_e
{
    NAL_PRIORITY_DISPOSABLE = 0,    // sei packet
    NAL_PRIORITY_LOW        = 1,    // X264_B_PYRAMID_STRICT = 1时的B slice
    NAL_PRIORITY_HIGH       = 2,    // I P X264_B_PYRAMID_STRICT != B slice
    NAL_PRIORITY_HIGHEST    = 3,    // IDR slice
};

typedef struct {
    int i_ref_idc;  /* nal_priority_e */
    int i_type;     /* nal_unit_type_e */
    int b_long_startcode;

    /* Size of payload (including any padding) in bytes. */
    int     i_payload;
    uint8_t *p_payload;

    int i_first_mb; /* If this NAL is a slice, the index of the first MB in the slice. */
    int i_last_mb;  /* If this NAL is a slice, the index of the last MB in the slice. */

}nal_t;

#endif